home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * (a) (C) 1990 by Adobe Systems Incorporated. All rights reserved.
- *
- * (b) If this Sample Code is distributed as part of the Display PostScript
- * System Software Development Kit from Adobe Systems Incorporated,
- * then this copy is designated as Development Software and its use is
- * subject to the terms of the License Agreement attached to such Kit.
- *
- * (c) If this Sample Code is distributed independently, then the following
- * terms apply:
- *
- * (d) This file may be freely copied and redistributed as long as:
- * 1) Parts (a), (d), (e) and (f) continue to be included in the file,
- * 2) If the file has been modified in any way, a notice of such
- * modification is conspicuously indicated.
- *
- * (e) PostScript, Display PostScript, and Adobe are registered trademarks of
- * Adobe Systems Incorporated.
- *
- * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
- * CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
- * AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
- * ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
- * OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
- * WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
- * WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
- * DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
- * OF THIRD PARTY RIGHTS.
- */
-
- /*
- * DetectViewWraps.psw
- *
- * The wraps used to check for hit detection, draw the control points
- * and lines and create the control points font.
- */
-
- defineps PSWSetUpath (float numstring Pts[Tot_Pts]; int Tot_Pts;
- char Ops[Tot_Ops]; int Tot_Ops)
- [Pts (Ops)]
- endps
-
- defineps PSWUpathStroke(userobject UPath)
- UPath ustroke
- endps
-
- /*
- * The return value, Hit, is the result of the inustroke
- * operation, either true or false.
- */
- defineps PSWHitPath(float numstring HPts[Tot_HPts]; int Tot_HPts;
- char HOps[Tot_HOps]; int Tot_HOps; float numstring Pts[Tot_Pts];
- int Tot_Pts; char Ops[Tot_Ops]; int Tot_Ops | boolean *Hit)
- [HPts (HOps)] [Pts (Ops)] inustroke Hit
- endps
-
- defineps PSWDrawControlPoints (float X, Y; float numstring Pts[Tot_Pts]; int Tot_Pts; char *Chs)
- X Y moveto (Chs) Pts xyshow
- endps
-
- /*
- * The sa and rsa procedures ensure that the first character is drawn correctly
- * with respect to device space. It's not so much an issue with square
- * images but can be quite significant with other shapes.
- */
- defineps PSWDefineFont(char *fontname)
- 10 dict dup begin
- /sa { % x y sa x' y'
- transform
- 0.25 sub round 0.25 add exch
- 0.25 sub round 0.25 add exch
- itransform
- } bind def
-
- /rsa { %dx dy rsa dx' dy'
- dtransform
- round exch
- round exch
- idtransform
- } bind def
-
- /FontName /fontname def
- /FontType 3 def
- /FontMatrix [.001 0 0 .001 0 0] def
- /FontBBox [-500 -500 500 500] def
-
- /Encoding 256 array def
- 0 1 255 {Encoding exch /.notdef put} for
-
- Encoding
- dup (a) 0 get /Rectfill put
- (b) 0 get /Rectopen put
-
- /CharProcs 3 dict def
- CharProcs begin
- /.notdef { } def
- /Rectfill
- {
- -300 -300 sa moveto 0 600 rsa rlineto
- 600 0 rsa rlineto 0 -600 rsa rlineto closepath
- fill
- } def
- /Rectopen
- {
- -300 -300 sa moveto 0 600 rsa rlineto
- 600 0 rsa rlineto 0 -600 rsa rlineto closepath
- stroke
- } def
- end
-
- /BuildChar
- {
- 500 0 -500 -500 500 500 setcachedevice
- exch begin
- Encoding exch get
- CharProcs exch get
- exec
- end
- } def
- end
-
- /fontname exch definefont pop
- endps
-
-